home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-02-03 | 55.7 KB | 1,996 lines |
- Newsgroups: comp.sources.x
- Path: uunet!elroy.jpl.nasa.gov!ames!pasteur!nntp
- From: scott.oaks@East.Sun.COM (Scott Oaks)
- Subject: v15i164: OpenLook Virtual Window Mgr (3.0), Part18/21
- Message-ID: <1992Feb4.140021.8205@pasteur.Berkeley.EDU>
- Sender: dcmartin@msi.com (David C. Martin - Moderator)
- Nntp-Posting-Host: postgres.berkeley.edu
- Organization: University of California, at Berkeley
- References: <csx-15i147-olvwm-3.0@uunet.UU.NET>
- Date: Tue, 4 Feb 1992 14:00:21 GMT
- Approved: dcmartin@msi.com
-
- Submitted-by: scott.oaks@East.Sun.COM (Scott Oaks)
- Posting-number: Volume 15, Issue 164
- Archive-name: olvwm-3.0/part18
-
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # If this archive is complete, you will see the following message at the end:
- # "End of archive 18 (of 21)."
- # Contents: Error.c Select.c gettext.c menu.h olvwmrc.man olwm.h
- # Wrapped by dcmartin@fascet on Tue Jan 14 05:54:48 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Error.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Error.c'\"
- else
- echo shar: Extracting \"'Error.c'\" \(9595 characters\)
- sed "s/^X//" >'Error.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
- X * pending in the U.S. and foreign countries. See LEGAL_NOTICE
- X * file for terms of the license.
- X */
- X
- X#ident "@(#)Error.c 1.1 olvwm version 1/3/92"
- X
- X/*
- X * Based on
- X#ident "@(#)Error.c 26.9 91/09/14 SMI"
- X *
- X */
- X
- X#include <stdio.h>
- X#include <X11/Xproto.h>
- X#include <X11/Xlib.h>
- X
- X#include "i18n.h"
- X
- X/* globals */
- X
- X/* locals */
- Xstatic char *hyperSensitive = NULL;
- X
- X#define NXOPCODES 128 /* # of X opcodes */
- Xtypedef struct {
- X unsigned int fatal, warning, ignore;
- X} ErrorEntry;
- X
- X/* The following defines create bitmasks from the X Error Codes */
- X#define BReq (1<<BadRequest)
- X#define BVal (1<<BadValue)
- X#define BWin (1<<BadWindow)
- X#define BPix (1<<BadPixmap)
- X#define BAtm (1<<BadAtom)
- X#define BCur (1<<BadCursor)
- X#define BFnt (1<<BadFont)
- X#define BMch (1<<BadMatch)
- X#define BDrw (1<<BadDrawable)
- X#define BAcc (1<<BadAccess)
- X#define BAlc (1<<BadAlloc)
- X#define BCol (1<<BadColor)
- X#define BGC (1<<BadGC)
- X#define BIDC (1<<BadIDChoice)
- X#define BNam (1<<BadName)
- X#define BLen (1<<BadLength)
- X#define BImp (1<<BadImplementation)
- X
- X#define BAll (~0) /* matches all error bitmasks */
- X
- X/* This error table encodes the severity of an error in relation to
- X * an X primitive. For instance if BadWindow was fatal for
- X * a certain primitive but BadColor was not, the following entry would be used:
- X * {BWin, BCol, 0}
- X */
- Xstatic ErrorEntry errorTable[NXOPCODES] = {
- X {BAll, 0, 0}, /* 0, Not Used */
- X {BAll, 0, 0}, /* 1, X_CreateWindow */
- X {0, ~BWin, BWin}, /* 2, X_ChangeWindowAttributes */
- X {0, ~BWin, BWin}, /* 3, X_GetWindowAttributes */
- X {0, BAll, 0}, /* 4, X_DestroyWindow */
- X {0, BAll, 0}, /* 5, X_DestroySubwindows */
- X {0, ~BWin, BWin}, /* 6, X_ChangeSaveSet */
- X {0, ~BWin, BWin}, /* 7, X_ReparentWindow */
- X {0, ~BWin, BWin}, /* 8, X_MapWindow */
- X {0, BAll, 0}, /* 9, X_MapSubwindows */
- X {0, ~BWin, BWin}, /* 10, X_UnmapWindow */
- X {0, BAll, 0}, /* 11, X_UnmapSubwindows */
- X {0, ~BWin, BWin}, /* 12, X_ConfigureWindow */
- X {0, BAll, 0}, /* 13, X_CirculateWindow */
- X {0, ~BDrw, BDrw}, /* 14, X_GetGeometry */
- X {0, ~BWin, BWin}, /* 15, X_QueryTree */
- X {0, BAll, 0}, /* 16, X_InternAtom */
- X {0, BAll, 0}, /* 17, X_GetAtomName */
- X {0, ~BWin, BWin}, /* 18, X_ChangeProperty */
- X {0, BAll, 0}, /* 19, X_DeleteProperty */
- X {0, ~BWin, BWin}, /* 20, X_GetProperty */
- X {0, BAll, 0}, /* 21, X_ListProperties */
- X {0, BAll, 0}, /* 22, X_SetSelectionOwner */
- X {0, BAll, 0}, /* 23, X_GetSelectionOwner */
- X {0, BAll, 0}, /* 24, X_ConvertSelection */
- X {0, ~BWin, BWin}, /* 25, X_SendEvent */
- X {0, 0, BAll}, /* 26, X_GrabPointer */
- X {0, 0, BAll}, /* 27, X_UngrabPointer */
- X {0, 0, BAll}, /* 28, X_GrabButton */
- X {0, 0, BAll}, /* 29, X_UngrabButton */
- X {0, 0, BAll}, /* 30, X_ChangeActivePointerGrab */
- X {0, BAll, 0}, /* 31, X_GrabKeyboard */
- X {0, BAll, 0}, /* 32, X_UngrabKeyboard */
- X {0, BAll, 0}, /* 33, X_GrabKey */
- X {0, BAll, 0}, /* 34, X_UngrabKey */
- X {0, BAll, 0}, /* 35, X_AllowEvents */
- X {BAll, 0, 0}, /* 36, X_GrabServer */
- X {0, BAll, 0}, /* 37, X_UngrabServer */
- X {0, BAll, 0}, /* 38, X_QueryPointer */
- X {0, BAll, 0}, /* 39, X_GetMotionEvents */
- X {0, BAll, 0}, /* 40, X_TranslateCoords */
- X {0, BAll, 0}, /* 41, X_WarpPointer */
- X {0, ~(BMch|BWin), BMch|BWin}, /* 42, X_SetInputFocus */
- X {0, BAll, 0}, /* 43, X_GetInputFocus */
- X {0, BAll, 0}, /* 44, X_QueryKeymap */
- X {0, BAll, 0}, /* 45, X_OpenFont */
- X {0, BAll, 0}, /* 46, X_CloseFont */
- X {0, BAll, 0}, /* 47, X_QueryFont */
- X {0, BAll, 0}, /* 48, X_QueryTextExtents */
- X {0, BAll, 0}, /* 49, X_ListFonts */
- X {0, BAll, 0}, /* 50, X_ListFontsWithInfo */
- X {0, BAll, 0}, /* 51, X_SetFontPath */
- X {0, BAll, 0}, /* 52, X_GetFontPath */
- X {0, BAll, 0}, /* 53, X_CreatePixmap */
- X {0, BAll, 0}, /* 54, X_FreePixmap */
- X {0, BAll, 0}, /* 55, X_CreateGC */
- X {0, BAll, 0}, /* 56, X_ChangeGC */
- X {0, BAll, 0}, /* 57, X_CopyGC */
- X {0, BAll, 0}, /* 58, X_SetDashes */
- X {0, BAll, 0}, /* 59, X_SetClipRectangles */
- X {0, BAll, 0}, /* 60, X_FreeGC */
- X {0, ~BMch, BMch}, /* 61, X_ClearArea */
- X {0, BAll, 0}, /* 62, X_CopyArea */
- X {0, BAll, 0}, /* 63, X_CopyPlane */
- X {0, BAll, 0}, /* 64, X_PolyPoint */
- X {0, BAll, 0}, /* 65, X_PolyLine */
- X {0, BAll, 0}, /* 66, X_PolySegment */
- X {0, BAll, 0}, /* 67, X_PolyRectangle */
- X {0, BAll, 0}, /* 68, X_PolyArc */
- X {0, BAll, 0}, /* 69, X_FillPoly */
- X {0, BAll, 0}, /* 70, X_PolyFillRectangle */
- X {0, BAll, 0}, /* 71, X_PolyFillArc */
- X {0, BAll, 0}, /* 72, X_PutImage */
- X {0, BAll, 0}, /* 73, X_GetImage */
- X {0, BAll, 0}, /* 74, X_PolyText8 */
- X {0, BAll, 0}, /* 75, X_PolyText16 */
- X {0, BAll, 0}, /* 76, X_ImageText8 */
- X {0, BAll, 0}, /* 77, X_ImageText16 */
- X {0, BAll, 0}, /* 78, X_CreateColormap */
- X {0, BAll, 0}, /* 79, X_FreeColormap */
- X {0, BAll, 0}, /* 80, X_CopyColormapAndFree */
- X {0, BAll, 0}, /* 81, X_InstallColormap */
- X {0, BAll, 0}, /* 82, X_UninstallColormap */
- X {0, BAll, 0}, /* 83, X_ListInstalledColormaps */
- X {0, BAll, 0}, /* 84, X_AllocColor */
- X {0, BAll, 0}, /* 85, X_AllocNamedColor */
- X {0, BAll, 0}, /* 86, X_AllocColorCells */
- X {0, BAll, 0}, /* 87, X_AllocColorPlanes */
- X {0, BAll, 0}, /* 88, X_FreeColors */
- X {0, BAll, 0}, /* 89, X_StoreColors */
- X {0, BAll, 0}, /* 90, X_StoreNamedColor */
- X {0, BAll, 0}, /* 91, X_QueryColors */
- X {0, BAll, 0}, /* 92, X_LookupColor */
- X {0, BAll, 0}, /* 93, X_CreateCursor */
- X {0, BAll, 0}, /* 94, X_CreateGlyphCursor */
- X {0, BAll, 0}, /* 95, X_FreeCursor */
- X {0, BAll, 0}, /* 96, X_RecolorCursor */
- X {0, BAll, 0}, /* 97, X_QueryBestSize */
- X {0, BAll, 0}, /* 98, X_QueryExtension */
- X {0, BAll, 0}, /* 99, X_ListExtensions */
- X {0, BAll, 0}, /* 100, X_ChangeKeyboardMapping */
- X {0, BAll, 0}, /* 101, X_GetKeyboardMapping */
- X {0, BAll, 0}, /* 102, X_ChangeKeyboardControl */
- X {0, BAll, 0}, /* 103, X_GetKeyboardControl */
- X {0, BAll, 0}, /* 104, X_Bell */
- X {0, BAll, 0}, /* 105, X_ChangePointerControl */
- X {0, BAll, 0}, /* 106, X_GetPointerControl */
- X {0, BAll, 0}, /* 107, X_SetScreenSaver */
- X {0, BAll, 0}, /* 108, X_GetScreenSaver */
- X {0, BAll, 0}, /* 109, X_ChangeHosts */
- X {0, BAll, 0}, /* 110, X_ListHosts */
- X {0, BAll, 0}, /* 111, X_SetAccessControl */
- X {0, BAll, 0}, /* 112, X_SetCloseDownMode */
- X {0, BAll, 0}, /* 113, X_KillClient */
- X {0, BAll, 0}, /* 114, X_RotateProperties */
- X {0, BAll, 0}, /* 115, X_ForceScreenSaver */
- X {0, BAll, 0}, /* 116, X_SetPointerMapping */
- X {0, BAll, 0}, /* 117, X_GetPointerMapping */
- X {0, BAll, 0}, /* 118, X_SetModifierMapping */
- X {0, BAll, 0}, /* 119, X_GetModifierMapping */
- X {BAll, 0, 0}, /* 120, Not Used */
- X {BAll, 0, 0}, /* 121, Not Used */
- X {BAll, 0, 0}, /* 122, Not Used */
- X {BAll, 0, 0}, /* 123, Not Used */
- X {BAll, 0, 0}, /* 124, Not Used */
- X {BAll, 0, 0}, /* 125, Not Used */
- X {BAll, 0, 0}, /* 126, Not Used */
- X {0, BAll, 0}, /* 127, X_NoOperation */
- X };
- X/*
- X * ErrorSensitive -- cause an exit on all X errors
- X */
- XErrorSensitive(s)
- Xchar *s;
- X{
- X hyperSensitive = s;
- X}
- X
- X/*
- X * ErrorInsensitive -- perform normal X error processing
- X */
- X/*ARGSUSED*/ /* dpy arg will be used when multiple Displays supported */
- XErrorInsensitive(dpy)
- XDisplay *dpy;
- X{
- X hyperSensitive = NULL;
- X}
- X
- X/*
- X * ErrorHandler -- this routine is called whenever an error in the X
- X * protocol is detected.
- X */
- XErrorHandler(dpy, event)
- XDisplay *dpy;
- XXErrorEvent *event;
- X{
- X char buffer[BUFSIZ];
- X int errBitmask;
- X
- X XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
- X
- X if (hyperSensitive != NULL)
- X {
- X /* treat all errors as fatal */
- X (void) fprintf(stderr, gettext("olvwm: Fatal X Error: %s\n"), buffer);
- X (void) fprintf(stderr, "%s\n", hyperSensitive);
- X exit(-1);
- X /*NOTREACHED*/
- X }
- X
- X errBitmask = 1 << event->error_code;
- X
- X if (errBitmask & errorTable[event->request_code].ignore)
- X return 0;
- X else if (errBitmask & errorTable[event->request_code].warning)
- X {
- X (void) fprintf(stderr, gettext("olvwm: Warning, X Error: %s\n"),
- X buffer);
- X (void) fprintf(stderr, gettext(" Request Major code: %d\n"),
- X event->request_code);
- X (void) fprintf(stderr, gettext(" Request Minor code: %d\n"),
- X event->minor_code);
- X (void) fprintf(stderr, gettext(" ResourceId 0x%x\n"),
- X event->resourceid);
- X return 0;
- X }
- X else if (errBitmask & errorTable[event->request_code].fatal)
- X {
- X (void) fprintf(stderr, gettext("olvwm: Fatal X Error: %s\n"),
- X buffer);
- X (void) fprintf(stderr, gettext(" Request Major code: %d\n"),
- X event->request_code);
- X (void) fprintf(stderr, gettext(" Request Minor code: %d\n"),
- X event->minor_code);
- X (void) fprintf(stderr, gettext(" ResourceId 0x%x\n"),
- X event->resourceid);
- X (void) fprintf(stderr, gettext(" Error Serial #%d\n"),
- X event->serial);
- X (void) fprintf(stderr, gettext(" Current Serial #%d\n"),
- X dpy->request);
- X /* do not return from fatal errors */
- X exit(-1);
- X /*NOTREACHED*/
- X }
- X
- X return 0;
- X}
- X
- X/*
- X * ErrorGeneral -- this routine is called whenever a general error occurs
- X * within OLWM. Exits from olwm.
- X */
- XErrorGeneral(txt)
- Xchar *txt;
- X{
- X (void) fprintf(stderr, gettext("olvwm: Fatal Error: %s\n"), txt);
- X#ifdef DEBUG
- X abort();
- X /*NOTREACHED*/
- X#else
- X exit(-1);
- X /*NOTREACHED*/
- X#endif
- X}
- X
- X/*
- X * ErrorWarning -- this routine is called whenever a condition requiring
- X * a warning message occurs within OLWM.
- X */
- Xvoid
- XErrorWarning(txt)
- Xchar *txt;
- X{
- X (void) fprintf(stderr, gettext("olvwm: Warning: %s\n"), txt);
- X}
- X
- END_OF_FILE
- if test 9595 -ne `wc -c <'Error.c'`; then
- echo shar: \"'Error.c'\" unpacked with wrong size!
- fi
- # end of 'Error.c'
- fi
- if test -f 'Select.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Select.c'\"
- else
- echo shar: Extracting \"'Select.c'\" \(9439 characters\)
- sed "s/^X//" >'Select.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
- X * pending in the U.S. and foreign countries. See LEGAL_NOTICE
- X * file for terms of the license.
- X */
- X
- X#ident "@(#)Select.c 26.13 91/09/14 SMI"
- X
- X#include <errno.h>
- X#include <stdio.h>
- X#include <string.h>
- X#include <X11/Xos.h>
- X#include <X11/Xlib.h>
- X#include <X11/Xutil.h>
- X#include <X11/Xatom.h>
- X
- X#include "i18n.h"
- X#include "olwm.h"
- X#include "win.h"
- X#include "list.h"
- X#include "mem.h"
- X
- Xstatic List *selectList = NULL_LIST;
- X
- XTime SelectionTime;
- X
- X/* Externals */
- Xextern Atom AtomAtomPair;
- Xextern Atom AtomLength;
- Xextern Atom AtomListLength;
- Xextern Atom AtomName;
- Xextern Atom AtomMultiple;
- Xextern Atom AtomOlwmTimestamp;
- Xextern Atom AtomTargets;
- Xextern Atom AtomTimestamp;
- X
- X/*
- X * IsSelected -- returns boolean telling whether or not client is selected.
- X *
- X * Input:
- X *
- X * cli - client which might be on selection list.
- X *
- X * Output:
- X *
- X * Returns True if the client cli is on the selection list.
- X * Returns False if it is not.
- X *
- X * Globals:
- X *
- X * selectList - The list of selected windows.
- X */
- XBool
- XIsSelected(cli)
- XClient *cli;
- X{
- X return cli->isSelected;
- X}
- X
- X
- X/*
- X * AddSelection -- add this client to the selection list if it is not
- X * already present. This routine also tells the server it is the current
- X * XA_PRIMARY selection owner.
- X *
- X * Input:
- X *
- X * cli - The client we are adding to the selectList.
- X *
- X * Output:
- X *
- X * None.
- X *
- X * Globals:
- X *
- X * selectList - The list of selected windows.
- X * The current selection owner in the server is also adjusted.
- X */
- Xint
- XAddSelection(cli, timestamp)
- XClient *cli;
- XTime timestamp;
- X{
- X List *l = selectList;
- X Client *tc;
- X
- X if (selectList == NULL_LIST)
- X {
- X /* Tell the server that we are now the
- X * current selection owner.
- X * We really only need to call this
- X * if this is the first window
- X * in the SelectList. Calling this sends the
- X * previous owner of the XA_PRIMARY selection
- X * a SelectionClear event, unless the previous
- X * owner was us already.
- X */
- X XSetSelectionOwner(cli->dpy, XA_PRIMARY,
- X NoFocusWin,
- X timestamp);
- X }
- X else
- X {
- X /* First look to see if window is already listed. */
- X for(tc = ListEnum(&l); tc != NULL; tc = ListEnum(&l))
- X {
- X if (tc == cli)
- X return;
- X }
- X }
- X
- X /* If we get here the window wasn't already in the list. */
- X selectList = ListCons(cli,selectList);
- X cli->isSelected = True;
- X
- X /* Tell the window it is selected. */
- X WinCallSelect(cli, True);
- X SelectionTime = timestamp;
- X}
- X
- X/*
- X * RemoveSelection -- de-select the window
- X *
- X * Purpose:
- X * This routine will remove an entry from the SelectList.
- X * Input:
- X *
- X * winInfo - The window we are removing from the SelectList.
- X *
- X * Output:
- X * Returns True if client was deselected; false if the
- X * client was not already selected.
- X *
- X * Globals:
- X *
- X * selectList - The list of selected windows.
- X */
- XBool
- XRemoveSelection(cli)
- XClient *cli;
- X{
- X List **l;
- X
- X for (l = &selectList ; *l != NULL; l = &((*l)->next))
- X {
- X if ((*l)->value == cli)
- X {
- X ListDestroyCell(l);
- X cli->isSelected = False;
- X WinCallSelect(cli,False);
- X return True;
- X }
- X }
- X return False;
- X}
- X
- X
- X
- X/*
- X * ToggleSelection -- if the winInfo is already selected, then de-select it.
- X * If not, then select it.
- X * Returns whether it is selected or not.
- X */
- XBool
- XToggleSelection(cli, timestamp)
- XClient *cli;
- XTime timestamp;
- X{
- X
- X /* If already present, we want to deselect. */
- X if (RemoveSelection(cli))
- X return False;
- X else
- X {
- X AddSelection(cli, timestamp);
- X return True;
- X }
- X}
- X
- X
- X/*
- X * ClearSelections -- clear the selection list
- X */
- X/*ARGSUSED*/
- Xvoid
- XClearSelections(dpy)
- XDisplay *dpy;
- X{
- X List *l;
- X Client *cli;
- X
- X l = selectList;
- X for(cli = ListEnum(&l); cli != NULL; cli = ListEnum(&l))
- X {
- X cli->isSelected = False;
- X WinCallSelect(cli,False);
- X }
- X ListDestroy(selectList);
- X selectList = NULL_LIST;
- X}
- X
- X/*
- X * EnumSelections --- enumerate the selected client structures.
- X * Pass NULL to begin enumeration; any non-NULL value thereafter
- X * will continue enumeration where it left off. This function
- X * uses static data, so only one enumeration can happen at any
- X * given time.
- X * Returns NULL when list is exhausted.
- X */
- XClient *
- XEnumSelections(foo)
- Xvoid *foo;
- X{
- X static List *l;
- X Client *ct;
- X
- X if (foo == NULL)
- X l = selectList;
- X
- X if (l != NULL)
- X {
- X ct = l->value;
- X l = l->next;
- X return ct;
- X }
- X return NULL;
- X}
- X
- X
- X/*
- X * Handle the conversion of a single target. Used for both single requests
- X * and for MULTIPLE requests. Returns True if the conversion was successful,
- X * otherwise False.
- X */
- Xstatic Bool
- XhandleTarget(dpy, requestor, target, property)
- X Display *dpy;
- X Window requestor;
- X Atom target;
- X Atom property;
- X{
- X unsigned long data[10]; /* long enough for most things */
- X unsigned char *propdata = (unsigned char *) data;
- X int format, nelements, i;
- X Client *cli;
- X Atom type;
- X Bool freedata = False;
- X Window *wp;
- X
- X if (target == AtomTargets) {
- X data[0] = AtomTargets;
- X data[1] = AtomTimestamp;
- X data[2] = AtomListLength;
- X data[3] = XA_DRAWABLE;
- X data[4] = AtomLength;
- X data[5] = AtomMultiple;
- X data[6] = AtomName;
- X nelements = 7;
- X type = XA_ATOM;
- X format = 32;
- X } else if (target == AtomTimestamp) {
- X data[0] = SelectionTime;
- X nelements = 1;
- X type = XA_INTEGER;
- X format = 32;
- X } else if (target == AtomListLength) {
- X data[0] = ListCount(selectList);
- X nelements = 1;
- X type = XA_INTEGER;
- X format = 32;
- X } else if (target == AtomLength) {
- X data[0] = ListCount(selectList)*sizeof(long);
- X nelements = 1;
- X type = XA_INTEGER;
- X format = 32;
- X } else if (target == XA_DRAWABLE) {
- X nelements = ListCount(selectList);
- X propdata = (unsigned char *)
- X MemCalloc(nelements, sizeof(unsigned long));
- X freedata = True;
- X wp = (Window *) propdata;
- X i = 0;
- X cli = NULL;
- X while ((cli = EnumSelections(cli)) && (i<nelements))
- X *wp++ = PANEWINOFCLIENT(cli);
- X type = XA_DRAWABLE;
- X format = 32;
- X } else if (target == AtomName) {
- X int curlen = 0;
- X int maxlen = 100;
- X int tmplen;
- X char *cp, *tmp;
- X
- X propdata = MemAlloc(maxlen);
- X cp = (char *) propdata;
- X
- X cli = NULL;
- X while (cli = EnumSelections(cli)) {
- X if (cli->framewin != NULL && cli->framewin->fcore.name != NULL)
- X tmp = cli->framewin->fcore.name;
- X else
- X tmp = "";
- X
- X tmplen = strlen(tmp) + 1;
- X if (curlen + tmplen > maxlen) {
- X maxlen += 100;
- X propdata = MemRealloc(propdata, maxlen);
- X }
- X strcpy((char *) propdata+curlen, tmp);
- X curlen += tmplen;
- X }
- X
- X nelements = curlen;
- X type = XA_STRING;
- X format = 8;
- X } else {
- X return False;
- X }
- X
- X XChangeProperty(dpy, requestor, property, type, format, PropModeReplace,
- X (unsigned char *)propdata, nelements);
- X
- X if (freedata)
- X MemFree(propdata);
- X
- X return True;
- X}
- X
- X
- X/*
- X * SelectionResponse
- X * Respond to a selection request in the manner specified by the ICCCM.
- X * If we understand the target, write the appropriate property and send the
- X * event. If we don't understand the target, just send the event.
- X */
- Xvoid
- XSelectionResponse(request)
- X XSelectionRequestEvent *request;
- X{
- X XSelectionEvent response;
- X Atom *pairs;
- X Atom zeroatom = None;
- X unsigned long nitems, remain;
- X int i;
- X Bool writeback = False;
- X
- X response.type = SelectionNotify;
- X response.serial = request->serial;
- X response.requestor = request->requestor;
- X response.selection = request->selection;
- X response.time = request->time;
- X response.target = None;
- X response.property = None;
- X
- X if (request->target == AtomMultiple) {
- X if (request->property != None) {
- X pairs = GetWindowProperty(request->display, request->requestor,
- X request->property, 0L, 100000L,
- X AtomAtomPair, 32, &nitems, &remain);
- X
- X if (pairs != NULL) {
- X
- X /*
- X * Process each pair of atoms (target, property). Watch out
- X * for an odd last atom, and for property atoms of None. If
- X * the conversion fails, replace it with None in the original
- X * property.
- X */
- X
- X for (i = 0; i+1 < nitems; i += 2) {
- X
- X if (pairs[i+1] == None)
- X continue;
- X
- X if (!handleTarget(request->display, request->requestor,
- X pairs[i], pairs[i+1]))
- X {
- X pairs[i+1] = None;
- X writeback = True;
- X }
- X }
- X
- X if (writeback)
- X XChangeProperty(request->display, request->requestor,
- X request->property, AtomAtomPair, 32, PropModeReplace,
- X (unsigned char *) pairs, nitems);
- X
- X XFree((char *) pairs);
- X }
- X
- X response.target = AtomMultiple;
- X response.property = request->property;
- X
- X }
- X } else {
- X /*
- X * If the property field is None, the requestor is using an obsolete
- X * draft of the ICCCM. Per the suggestion in ICCCM section 2.2, use
- X * the target name as the property name.
- X */
- X if (request->property == None)
- X request->property = request->target;
- X
- X if (handleTarget(request->display, request->requestor,
- X request->target, request->property))
- X {
- X response.target = request->target;
- X response.property = request->property;
- X }
- X }
- X
- X XSendEvent(request->display, request->requestor, False,
- X NoEventMask, (XEvent *)&response);
- X}
- X
- X/* TimeFresh -- get a fresh timestamp from the server
- X */
- XTime
- XTimeFresh(win)
- XWinGeneric *win;
- X{
- X XEvent e;
- X Time timestamp;
- X
- X XChangeProperty(win->core.client->dpy, win->core.self,
- X AtomOlwmTimestamp, XA_INTEGER,
- X 32, PropModeReplace, (unsigned char *)win, 0);
- X XSync(win->core.client->dpy,0);
- X if (XCheckTypedWindowEvent(win->core.client->dpy, win->core.self,
- X PropertyNotify, &e))
- X timestamp = e.xproperty.time;
- X else
- X timestamp = CurrentTime;
- X
- X return timestamp;
- X}
- END_OF_FILE
- if test 9439 -ne `wc -c <'Select.c'`; then
- echo shar: \"'Select.c'\" unpacked with wrong size!
- fi
- # end of 'Select.c'
- fi
- if test -f 'gettext.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'gettext.c'\"
- else
- echo shar: Extracting \"'gettext.c'\" \(9213 characters\)
- sed "s/^X//" >'gettext.c' <<'END_OF_FILE'
- X/* Copyright (c) 1990 Sun Microsystems */
- X/* All Rights Reserved */
- X
- X#ident "@(#)gettext.c 1.7 91/09/14 SMI"
- X
- X#ifdef SUNDAE
- X
- X#include "gettext.h"
- X
- X#ifdef SYSV
- X#define bzero(a,b) memset(a,0,b)
- X#endif
- X
- Xchar *malloc(), *strdup();
- Xchar * dgettext();
- Xchar *_gettext();
- Xchar *in_path();
- Xchar *fgets(), *getenv();
- Xcaddr_t mmap(), calloc();
- X
- Xstatic struct domain_binding *firstbind=0, *lastbind=0;
- X
- Xstatic void
- Xinitbindinglist()
- X{
- X if (! firstbind) {
- X firstbind =
- X (struct domain_binding *) malloc(sizeof(struct domain_binding));
- X firstbind->domain_name = strdup("");
- X firstbind->binding = strdup(DEFAULT_BINDING);
- X firstbind->nextdomain = (struct domain_binding *) 0;
- X lastbind = firstbind;
- X }
- X}
- X
- Xstatic char *
- Xlookupdefbind(domain_name)
- X char *domain_name;
- X{
- X static char *binding = NULL; /* psuedo static ptr for return value */
- X static int bindinglen = 0;
- X char *bindptr = firstbind->binding;
- X char *current_locale;
- X char chartmp;
- X char *bindtmptr, pathtmp[MAXPATHLEN], bindtmp[MAXPATHLEN];
- X int newlen;
- X
- X struct stat statbuf;
- X
- X bindtmptr = bindtmp;
- X
- X current_locale = setlocale(LC_MESSAGES, NULL);
- X
- X while (chartmp = *bindptr++) {
- X switch (chartmp) {
- X
- X case BINDINGLISTDELIM:
- X *bindtmptr = '\0';
- X strcpy(pathtmp, bindtmp);
- X strcat(pathtmp, "/");
- X strcat(pathtmp, current_locale);
- X strcat(pathtmp, "/LC_MESSAGES/");
- X strcat(pathtmp, domain_name);
- X strcat(pathtmp, ".mo");
- X
- X if (stat(pathtmp, &statbuf)) {
- X bindtmptr = bindtmp;
- X break;
- X }
- X
- X if ((newlen = strlen(bindtmp)) > bindinglen) {
- X bindinglen = newlen;
- X if (binding) {
- X free (binding);
- X }
- X binding = malloc(newlen+1);
- X strcpy(binding, bindtmp);
- X }
- X return(binding);
- X
- X default:
- X *bindtmptr++ = chartmp;
- X break;
- X }
- X }
- X /*
- X * NOT FOUND, return NULL
- X */
- X
- X return (NULL);
- X}
- X
- Xchar *
- Xbindtextdomain(domain_name, binding)
- X char *domain_name;
- X unsigned char *binding;
- X{
- X
- X struct domain_binding *bind;
- X char *lastpath;
- X unsigned char pathtmp[MAXPATHLEN+1];
- X int newlen;
- X
- X pathtmp[0] = '\0';
- X
- X /* Initialize list */
- X if (! firstbind) {
- X initbindinglist();
- X }
- X
- X if (!domain_name) {
- X return (NULL);
- X }
- X
- X if (*domain_name == '\0') {
- X if (!binding) {
- X /* query, add COOKIE to binding
- X * return new binding cookie
- X */
- X pathtmp[0] = (unsigned char) COOKIE;
- X pathtmp[1] = '\0';
- X strcat(pathtmp, firstbind->binding);
- X return (strdup(pathtmp));
- X } else if (binding[0] == COOKIE) {
- X /* result of a previous query,
- X * restore old binding
- X */
- X firstbind->binding = strdup(binding+1);
- X free(binding);
- X return (NULL);
- X } else {
- X /* add binding to default binding list
- X */
- X strcat(pathtmp, firstbind->binding);
- X free(firstbind->binding);
- X strcat(pathtmp, binding);
- X strcat(pathtmp, "\n");
- X firstbind->binding = strdup(pathtmp);
- X return (NULL);
- X }
- X }
- X
- X /* linear search for binding, rebind if found, add if not */
- X bind = firstbind;
- X while (bind) {
- X if (!strcmp(domain_name, bind->domain_name)) {
- X if (!binding) {
- X return(bind->domain_name);
- X }
- X if (bind->domain_name) {
- X free(bind->domain_name);
- X }
- X if (bind->binding) {
- X free(bind->binding);
- X }
- X
- X bind->domain_name = strdup(domain_name);
- X bind->binding = strdup(binding);
- X return (bind->binding);
- X }
- X bind = bind->nextdomain;
- X }
- X
- X /* Not found in list, add it to the end */
- X
- X if (!binding) {
- X return (NULL);
- X }
- X lastbind = bind = lastbind->nextdomain =
- X (struct domain_binding *) malloc(sizeof(struct domain_binding));
- X bind->domain_name = strdup(domain_name);
- X bind->binding = strdup(binding);
- X bind->nextdomain = 0;
- X return (bind->binding);
- X}
- X
- Xstatic char *
- Xfindtextdomain(domain_name)
- X char *domain_name;
- X{
- X struct domain_binding *bind;
- X char *tmptr;
- X
- X bind = firstbind;
- X
- X if (!bind) {
- X initbindinglist();
- X return (lookupdefbind(domain_name));
- X }
- X
- X while (bind) {
- X if (!strcmp(domain_name, bind->domain_name)) {
- X return (bind->binding);
- X }
- X bind = bind->nextdomain;
- X }
- X
- X /* not found, look for binding in default binding list */
- X return (lookupdefbind(domain_name));
- X}
- X
- X
- X
- Xchar *
- Xtextdomain(domain_name)
- X char *domain_name;
- X{
- X
- X static int entered = 0;
- X
- X static char current_domain[MAX_DOMAIN_LENGTH + 1];
- X
- X if (! entered) {
- X strcpy(current_domain, DEFAULT_DOMAIN);
- X entered = 1;
- X }
- X
- X if (domain_name == NULL) {
- X return(current_domain);
- X }
- X
- X if (strlen(domain_name) > MAX_DOMAIN_LENGTH) {
- X return(NULL);
- X }
- X
- X if (*domain_name == '\0') {
- X strcpy(current_domain, DEFAULT_DOMAIN);
- X } else {
- X strcpy(current_domain, domain_name);
- X }
- X
- X return(current_domain);
- X}
- X
- Xchar *
- Xgettext(msg_id)
- Xchar *msg_id;
- X{
- X return (dgettext(NULL, msg_id));
- X}
- X
- X
- Xchar *
- Xdgettext(domain_name, msg_id)
- X char *domain_name;
- X char *msg_id;
- X{
- X char msgfile[MAXPATHLEN+1];
- X
- X char *current_locale;
- X char *current_domain;
- X char *current_binding;
- X char *msgptr, *openwinhome = NULL;
- X
- X struct stat statbuf;
- X int fd = -1;
- X caddr_t addr;
- X
- X int msg_inc;
- X
- X static int top_list = 0; /* top of message_so list */
- X static int first_free = 0; /* first free entry in list */
- X static int last_entry_seen = 0; /* try this one first */
- X static struct message_so messages_so[MAX_MSG];
- X static struct message_so cur_mess_so; /* holds current message domain */
- X
- X
- X current_locale = setlocale(LC_MESSAGES, NULL);
- X
- X if (domain_name == NULL) {
- X current_domain = textdomain(NULL);
- X } else if (strlen(domain_name) > MAX_DOMAIN_LENGTH) {
- X return(msg_id);
- X } else if (*domain_name == '\0') {
- X current_domain = DEFAULT_DOMAIN;
- X } else {
- X current_domain = domain_name;
- X }
- X
- X /* check to see if textdomain has changed */
- X
- X
- X bzero(msgfile, sizeof(msgfile));
- X if (current_binding = findtextdomain(current_domain)) {
- X strcpy(msgfile, current_binding);
- X strcat(msgfile, "/");
- X strcat(msgfile, current_locale);
- X strcat(msgfile, "/LC_MESSAGES/");
- X strcat(msgfile, current_domain);
- X strcat(msgfile, ".mo");
- X } else {
- X return(msg_id);
- X }
- X
- X msg_inc = top_list;
- X while (msg_inc < first_free) {
- X if (!strcmp(msgfile, messages_so[msg_inc].message_so_path)) {
- X if (messages_so[msg_inc].fd != -1 &&
- X messages_so[msg_inc].mess_file_info !=
- X (struct struct_mo_info *) -1) {
- X cur_mess_so = messages_so[msg_inc];
- X last_entry_seen = msg_inc;
- X return (_gettext(cur_mess_so, msg_id));
- X } else {
- X return(msg_id);
- X }
- X }
- X msg_inc++;
- X }
- X
- X /*
- X been though entire queue and not found
- X open new entry if there is space.
- X */
- X
- X if (msg_inc == MAX_MSG) {
- X return (msg_id); /* not found and no more space */
- X }
- X if (first_free == MAX_MSG) {
- X return (msg_id); /* no more space */
- X }
- X
- X /*
- X * There is an available entry in the queue, so make a
- X * message_so for it and put it on the queue,
- X * return msg_id if message file isn't opened -or-
- X * mmap'd correctly
- X */
- X
- X/*
- X if ((fd = open(msgfile, O_RDONLY)) == -1) {
- X return (msg_id);
- X } else if (fstat(fd, &statbuf) == -1) {
- X close(fd);
- X return (msg_id);
- X } else if ((addr =
- X mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))
- X == (caddr_t) -1 ) {
- X close(fd);
- X return (msg_id);
- X }
- X close(fd);
- X*/
- X
- X fd = open(msgfile, O_RDONLY);
- X
- X messages_so[first_free].fd = fd;
- X messages_so[first_free].message_so_path = strdup(msgfile);
- X
- X if (fd == -1) {
- X first_free++;
- X close(fd);
- X return (msg_id);
- X }
- X
- X fstat(fd, &statbuf);
- X addr = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
- X close(fd);
- X
- X messages_so[first_free].mess_file_info = (struct struct_mo_info *) addr;
- X if (addr == (caddr_t) -1) {
- X first_free++;
- X return (msg_id);
- X }
- X
- X messages_so[first_free].message_list =
- X (struct message_struct *) &messages_so[first_free].mess_file_info[1];
- X messages_so[first_free].msg_ids =
- X (char *) &messages_so[first_free].message_list[messages_so[first_free].mess_file_info->message_count];
- X messages_so[first_free].msgs =
- X (char *) messages_so[first_free].msg_ids + messages_so[first_free].mess_file_info->string_count_msgid;
- X cur_mess_so = messages_so[first_free];
- X first_free++;
- X
- X
- X /* return pointer to message */
- X
- X return (_gettext(cur_mess_so,msg_id));
- X}
- X
- X
- Xchar *_gettext( messages, key_string )
- X struct message_so messages;
- X char *key_string ;
- X{
- X register int check;
- X register int val;
- X check = messages.mess_file_info->message_mid;
- X for (;;) {
- X if ((val=strcmp(key_string,
- X messages.msg_ids+messages.message_list[check].msgid_offset)) < 0) {
- X if (messages.message_list[check].less == -99) {
- X return (key_string);
- X } else {
- X check = messages.message_list[check].less;
- X }
- X } else if (val > 0) {
- X if (messages.message_list[check].more == -99) {
- X return (key_string);
- X } else {
- X check = messages.message_list[check].more;
- X }
- X } else {
- X return (messages.msgs+messages.message_list[check].msg_offset);
- X } /* if ((val= ... */
- X } /* for (;;) */
- X}
- X
- X#endif /* SUNDAE */
- END_OF_FILE
- if test 9213 -ne `wc -c <'gettext.c'`; then
- echo shar: \"'gettext.c'\" unpacked with wrong size!
- fi
- # end of 'gettext.c'
- fi
- if test -f 'menu.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'menu.h'\"
- else
- echo shar: Extracting \"'menu.h'\" \(8470 characters\)
- sed "s/^X//" >'menu.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
- X * pending in the U.S. and foreign countries. See LEGAL_NOTICE
- X * file for terms of the license.
- X */
- X
- X#ident "@(#)menu.h 26.24 91/09/14 SMI"
- X
- X/* a handy typedef for pointers to functions returning int */
- Xtypedef int (*FuncPtr) ();
- X
- X#define NOBUTTON -1 /* no button is active */
- X#define PINBUTTON -2 /* the pin is active */
- X
- X/* Button stacks (menus) are implemented as lists of buttons.
- X * Each button in a stack may in turn be stacked, this is indicated by
- X * the stacked flag of the button. If this flag is True then the buttonAction
- X * is a pointer to a new stack. Otherwise it is the function to be called
- X * after the menu has been dispatched.
- X */
- Xtypedef struct {
- X FuncPtr callback; /* if not stacked; call this */
- X struct _menu *submenu; /* Menu hasn't been defined yet */
- X} ButtonAction;
- X
- X/*
- X * Button Label: a Label may be either a string or a pixmap or both
- X * Items which don't have a type are not active (like the 2nd choice
- X * of a non-toggle item)
- X */
- X
- Xtypedef enum {NoType, StringLabel, ImageLabel, ComboLabel} ButtonLabelKind;
- X
- Xtypedef struct _buttonlabel {
- X ButtonLabelKind kind;
- X char *string;
- X Pixlabel *pixlabel;
- X} ButtonLabel;
- X
- X/*
- X * Button
- X */
- Xtypedef struct _button {
- X ButtonLabel label[2]; /* displayed label, alternate label */
- X char *helpstring[2]; /* help for that button, alternate help */
- X int which; /* which label to display */
- X Bool stacked; /* True if this is a button stack */
- X Bool enabled; /* Enabled/Disabled */
- X Bool visible; /* is this item visible at all? */
- X ButtonAction action; /* proc or submenu */
- X FuncPtr generate_func; /* If !NULL, called when this button is
- X * hilighted to re-initialize action.submenu */
- X char *generate_args; /* args for generate function */
- X} Button;
- X
- X/*
- X * Menu
- X */
- Xtypedef struct _menu {
- X char *title;
- X Button **buttons;
- X int buttonCount;
- X int buttonDefault;
- X Bool hasPushPin;
- X Bool menudirty; /* needs size recalced */
- X char *helpstring;
- X int btnPerCol; /* Number buttons per column */
- X int maxLabWidth; /* Maximum label width */
- X int maxLabHeight; /* Maximum button/label height */
- X int prefColSize; /* # of preferred columns */
- X} Menu;
- X
- X#define basewin_openitem 0
- X#define basewin_zoomitem (basewin_openitem + 1)
- X#define basewin_moveitem (basewin_zoomitem + 1)
- X#define basewin_resizeitem (basewin_moveitem + 1)
- X#define basewin_propsitem (basewin_resizeitem + 1)
- X#define basewin_backitem (basewin_propsitem + 1)
- X#define basewin_refreshitem (basewin_backitem + 1)
- X#define basewin_stickyitem (basewin_refreshitem + 1)
- X#define basewin_quititem (basewin_stickyitem + 1)
- X#define basewin_ctbuttons (basewin_quititem + 1)
- X
- X#define popup_dismissitem 0
- X#define popup_moveitem (popup_dismissitem + 1)
- X#define popup_resizeitem (popup_moveitem + 1)
- X#define popup_backitem (popup_resizeitem + 1)
- X#define popup_refreshitem (popup_backitem + 1)
- X#define popup_quititem (popup_refreshitem + 1)
- X#define popup_ctbuttons (popup_quititem + 1)
- X
- X#define limit_dismissthisitem 0
- X#define limit_dismissallitem (limit_dismissthisitem + 1)
- X#define limit_ctbuttons (limit_dismissallitem + 1)
- X
- X/*
- X * Global array of menus
- X *
- X * We need screen specific menus to get pixmaps in them, so this table
- X * has been moved to screen.h
- Xextern Menu *MenuTable[NUM_MENUS];
- X */
- Xextern Bool flDoSetDefault; /*is the ctrl key down (only used in winpinmenu.c)*/
- X
- X/*
- X * constants used by ShowStandardMenuSync()
- X */
- X#define SYNC_DONE 0
- X#define SYNC_CHANGECLICK (SYNC_DONE + 1)
- X
- X/*
- X * ButtonInfo
- X */
- Xtypedef struct _buttonInfo {
- X Button *button;
- X int buttonX, buttonY;
- X int buttonHeight;
- X Bool flDirty; /*damaged*/
- X Bool framed; /* True if button should be framed */
- X struct _menuInfo *subMenu;
- X} ButtonInfo;
- X
- X/*
- X * MenuInfo
- X */
- Xtypedef struct _menuInfo {
- X int depth;
- X Menu *menu;
- X ButtonInfo *buttons;
- X int notitleOffset, buttonOffset;
- X int menuX, menuY, menuWidth, menuHeight;
- X int titleX, titleY, titleHeight, titleWidth;
- X int pushPinX, pushPinY;
- X int maxbuttonWidth;
- X struct _wingeneric *menuWin;
- X struct _menuInfo *origmenuInfo;
- X struct _menuInfo *pinnedBrother;
- X Bool childActive;
- X Bool pinIn;
- X int litButton;
- X Bool ignoreNextExpose;
- X SemanticAction action;
- X int ringedButton;
- X int numColumns;
- X} MenuInfo;
- X
- X/*
- X * MenuCache - per screen
- X */
- Xtypedef struct _menuCache {
- X MenuInfo **menuInfoList; /* dynamic */
- X int nextSlot;
- X int maxSlots; /* how big is menuInfoList */
- X struct _winmenu **menuWinList;
- X int maxDepth;
- X} MenuCache;
- X
- Xtypedef enum _menuTrackMode {
- X MODE_DRAG, /* Press-Drag-Release */
- X MODE_CLICK /* Click-Move-Click */
- X} MenuTrackMode;
- X
- Xtypedef enum _menuLocation {
- X ML_BUTTON, /* On a button */
- X ML_PIN,/* On the pin */
- X ML_MENU, /* Elsewhere on the menu */
- X ML_OFFMENU, /* Outside the menu entirely */
- X ML_BUTTONDISABLED /*on a disabled button*/
- X} MenuLocation;
- X
- X#define BUTTON_INDEX_OK(mi,idx) ((idx)>=0 && (idx)<(mi)->menu->buttonCount)
- X
- X#ifdef notdef
- X/*
- X * Default button list
- X */
- Xtypedef struct _defaults {
- X char Name[80];
- X int DefaultButton;
- X MenuInfo *mInfo;
- X struct _defaults *next;
- X} Defaults, *DefaultsP;
- X#endif
- X
- X/*****************************************/
- X
- X
- X/*
- X * External functions
- X */
- Xvoid SetMenuDefault();
- XMenu *NewNamedMenu();
- XBool AppendMenuItem();
- XMenu *CreateMenu();
- XMenu *GetEnabledMenu();
- XMenuInfo *MenuInfoCreate();
- Xvoid ShowStandardMenu();
- Xvoid ShowStandardMenuSync();
- Xvoid SetClickCallback();
- X
- Xextern void InitMenus();
- Xextern MenuCache *InitScreenMenus( /* Display *dpy, ScreenInfo *scrInfo */ );
- Xextern void MenuCreate( /* dpy, menu */ );
- Xextern void MenuShow( /* dpy, WinGeneric, menu, event */ );
- Xextern void SetButton( /* dpy, menu, bindex, Bool */ );
- Xextern void ExecButtonAction( /* dpy, winInfo, menu, btn, Bool */ );
- Xextern void DrawMenu( /* dpy, menu */ );
- Xextern int PointInRect( /* x, y, rx, ry, rw, rh */ );
- X
- X
- X/*
- X * generically useful region code that happens to live in menu.c
- X */
- X
- Xvoid InitRegions();
- Xvoid EmptyRegion();
- Xvoid RectRegion();
- Xvoid AppendExposeDamage();
- Xvoid MakeExposeDamage();
- X
- X
- X/*
- X * WinMenu Functions (from winmenu.c)
- X */
- Xextern struct _winmenu *
- XMakeMenu( /* Display *dpy,
- X WinRoot *winInfo */
- X );
- Xextern void
- XMapMenuWindow(/* Display *dpy,
- X WinMenu *winInfo,
- X MenuInfo *menuInfo */
- X );
- Xextern void
- XUnmapMenuWindow(/* Display *dpy,
- X WinMenu *winInfo,
- X MenuInfo *menuInfo */
- X );
- X
- X
- Xint MenuEventExpose();
- Xint MenuEventDrawMenu();
- X
- X
- X/*
- X * WinPinMenu Functions (from winpinmenu.c)
- X */
- Xextern struct _winpinmenu *
- XMakePinMenu(/* Display *dpy,
- X WinRoot *winInfo,
- X MenuInfo *menuInfo */
- X );
- X
- X
- X/*
- X * macros for setting menu items
- X */
- X
- X#define DirtyMenu(pmenu) (pmenu)->menudirty = True
- X#define _menuset(p,i,q,x) do { \
- X Button *pb = p->buttons[i]; \
- X if (pb->q != (x)) { \
- X DirtyMenu(p); \
- X pb->q = (x); \
- X } \
- X } while(0)
- X#define ToggleVisible(p,i,x) _menuset(p,i,visible,(x))
- X#define ToggleItem(p,i,x) _menuset(p,i,which,(((x) == 0)? False : True))
- X#define ToggleEnabled(p,i,x) _menuset(p,i,enabled,(x))
- X#define SetMenuTitle(m,t) do { \
- X if (m->title != t) { \
- X m->title = t; \
- X DirtyMenu(m); \
- X } \
- X } while (0)
- X
- X/*
- X * This stuff really belongs in the olgx library (in olgx.h, in fact).
- X * But I don't want to ship that whole library, so I put it here and
- X * included only ol_button.c from olgx
- X */
- X
- X#define OLGX_LABEL_IS_COMB 0x0400 /* Label ix pixmap/string combination */
- X
- Xtypedef struct _comblabel {
- X Pixlabel pixlabel;
- X char *strlabel;
- X} Comblabel;
- X
- X/*
- X * eventX, eventY, eventTime
- X *
- X * Extract the xroot, yroot, or timestamp fields from an event, assuming it's
- X * a MotionNotify, ButtonPress, or ButtonRelease.
- X */
- X
- X#define eventX(e) ((e)->type == MotionNotify ? (e)->xmotion.x_root \
- X : (e)->xbutton.x_root )
- X
- X#define eventY(e) ((e)->type == MotionNotify ? (e)->xmotion.y_root \
- X : (e)->xbutton.y_root )
- X
- X#define eventTime(e) ((e)->type == MotionNotify ? (e)->xmotion.time \
- X : (e)->xbutton.time )
- END_OF_FILE
- if test 8470 -ne `wc -c <'menu.h'`; then
- echo shar: \"'menu.h'\" unpacked with wrong size!
- fi
- # end of 'menu.h'
- fi
- if test -f 'olvwmrc.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'olvwmrc.man'\"
- else
- echo shar: Extracting \"'olvwmrc.man'\" \(9546 characters\)
- sed "s/^X//" >'olvwmrc.man' <<'END_OF_FILE'
- X.\" @(#)olvwmrc.man 1.1 olvwm version 1/3/92
- X.TH OLVWMRC 5 "15 November 1991"
- X.SH NAME
- Xolvwmrc \- Resource file for the OPEN LOOK Virtual Window Manager
- X.SH SYNOPSIS
- X$HOME/.olvwmrc
- X.SH DESCRIPTION
- X .olvwmrc is a file which controls advanced keybinding and menu features
- Xfor the OPEN LOOK Window Manager
- X.I olvwm.
- XThree features of
- X.I olvwm
- Xare controlled by entries in this file:
- X.IP \fBKeybindings\fP
- Xwhich can map specific actions to function keys
- X.IP "\fBScreen Bindings\fP"
- Xwhich can control where certain applications are started
- X.IP \fBWINMENU\fP
- Xentries which can control the behavior of items selected from the
- X.I olvwm
- XWINMENU menu.
- X.LP
- XThe syntax for each of these entries is given below. Common to all
- Xsyntax entries is the notion of an ``identifier'': this is a string
- Xwhich somehow specifies which window(s) the given entry applies to.
- XWhen determining if a particular window is affected by a particular
- Xrule in
- X.I .olvwmrc,
- X.I olvwm
- Xfirst checks a window's WM_NAME to see if it matches the identifier
- Xlisted in the rule. This match is done only for the length of the
- Xidentifier, so that the identifier
- X.I Mail
- Xwill match all windows which
- Xbegin with the 4 letters Mail in their WM_NAME. If this does not match,
- X.I olvwm
- Xnext checks the instance and then the class fields of the window's
- XWM_CLASS attribute to check for a possible match. If a match is found
- Xfor any of these fields, the window is affected by the given rule. Case
- Xis significant in checking all matches.
- X.LP
- XIdentifiers may contain any alpha-numeric characters; any other characters
- Xmust be enclosed within quotes (single or double). Thus,
- X.I Mail
- Xis a valid identifier, as is
- X"\fIMail Tool\fP"
- Xbut
- X.I Mail Tool
- Xis not. Similarly, strings which are to be executed should be enclosed
- Xin quotes if they contain non alpha-numeric characters. Quotes may
- Xbe nested in strings, so that to start a clock with the label
- X.I foo bar,
- Xyou would specify \fI 'clock -label "foo bar"'\fP.
- XFinally, single quotes may be escaped with a backslash, so that the
- Xfull WM_NAME of DevGuide, for example, should appear as
- X\fI"OpenWindows Developer\\'s Guide"\fP.
- X.LP
- XAll whitespace in this file is ignored; and lines beginning with a #
- Xare considered comments (but only if the # is in column 1).
- X.SH Key/Action Bindings
- X.I olvwm
- Xcan be made to perfom a series of actions when a specific key is pressed.
- XThe key must be (on a Sun-4 keyboard) a Left Key (L1-L10), a Function
- XKey (F1-F10), or a Right Key (R1-R15). The key may be specified by itself
- Xor with any one or more of the following modifiers: Shift, Control, Alt,
- XMeta, Hyper, Super, Shift Lock, or Caps Lock, in which case the key
- Xmust be pressed with the given modifiers. Keyboards other than Sun-4
- Xwill have to set up key mappings to generate X function or right key symbols.
- X.LP
- XThe functionality for a key specified in a binding in
- X.I .olvwmrc
- Xtakes precedence over any other functions that key might perform. Thus,
- Xif you bind the L5 key to an action in
- X.I .olvwmrc,
- Xyou will not be able to use the L5 key to bring windows to the front;
- Xif you bind the R8 key, you will not be able to scroll up on the desktop
- Xusing that key. Since the unmodified versions of 29 of the possible 35
- Xkeys already have a meaning within
- X.I olvwm,
- Xit is recommend that at least one modifier be
- Xused for keys in this manner so as not to conflict with other key meanings.
- X.LP
- XThere are six valid actions which can be associated with a key:
- X.IP \fBWarp\fR
- XThis action requires a single identifier. The youngest window
- Xmatching this identifier will be located, and the view into the desktop
- Xwill be warped so that the found window is displayed on the screen. The
- Xwindow itself will not change position relative to the other windows;
- Xmerely the view into the desktop will be changed. If no matching
- Xwindow is found, the view is unchanged. The mouse is moved into the
- Xmatching window, and that window is given input focus.
- X.IP \fBOpen\fR
- XThis action requires a list of identifiers separated by commas. Each
- Xiconified window will be matched against this list and those which match
- Xany identifier in the list will be opened.
- X.IP \fBClose\fR
- XThis action requires a list of identifiers separated by commas. Each
- Xnon-iconified window will be matched against this list and those which match
- Xany identifier in the list will be closed.
- X.IP \fBRaise\fR
- XThis action requires a list of identifiers separated by commas. Each
- Xwindow will be matched against this list and those which match any
- Xidentifier in the list will be raised. Windows will be raised youngest
- Xfirst, so that the oldest windows in the list will end up on top.
- X.IP \fBExecute\fR
- XThis action requires a list of commands separated by commas. Each
- Xcommand will be executed via a Bourne-shell in the same manner as
- Xcommands given in the
- X.I olvwm
- Xmenu file [except that multiple commands may be listed in this case.]
- X.IP \fBGoto\fR
- XThis action requires a single integer parameter, which is the logical
- Xscreen to which the desktop should warp when the given key(s) are pressed.
- X.IP \fBQuit\fR
- XThis action requires a list of identifiers separated by commas. Each
- Xwindow will be matched against this list and those which match
- Xany identifier in the list will be killed.
- X.LP
- XThese actions may appear in any order and will be performed in the
- Xreverse of the order specified. Commands may be listed multiple times;
- Xthis is useful in case you want a different stacking order than that
- Xobtained by using a single
- Xraise command. To do this, list separate raise commands for each window
- Xand put the raise command for the window you want to be on top first.
- X.LP
- XThe full syntax for a Key/Action binding is
- X.IP
- X.I KeyName { Actions }
- X.LP
- XA Key Name is a valid key (L1-L10, F1-F10, or R1-R15) followed by plus
- Xsigns and the modifiers desired.
- X.LP
- XFor example, given the following entry:
- X.br
- X.nf
- X
- XL2 + Shift {
- X Warp: "OpenWindows Developer\\'s Guide"
- X Execute: '$OPENWINHOME/bin/xview/clock -label "foo bar"',
- X "$OPENWINHOME/bin/xview/iconedit"
- X Raise: xterm, shelltool
- X}
- X
- X.SH
- XThen when Shift L2 is pressed, the following will occur:
- X.IP 1)
- XThe view will shift so that the youngest copy of DevGuide is on the screen.
- X.IP 2)
- XA clock will be started; its namestripe will contain foo bar.
- XThe IconEditor will also be started.
- X.IP 3)
- XAll xterms and shelltools will be raised to the front of the stacking order.
- X.SH Screen Bindings
- X.I olvwm
- Xcan arrange to begin any application relative to a particular logical screen.
- XA ``logical screen'' is the area on the virtual desktop which maps to
- Xthe size of your monitor; in the VDM, each logical screen is outlined in
- Xdashed lines (unless you've turned this feature off). Screens are numbered
- Xby row starting with 1. Note that the position of a logical screen will
- Xvary depending on the size of a desktop: in the default (2x3) configuration,
- Xscreen 4 is in the bottom left-hand corner of the VDM but in a smaller
- X(2x2) configuration, it is in the bottom right-hand corner.
- X.LP
- XThe syntax for specifying a screen binding is
- X.IP
- X.I Screen # { Identifiers }
- X.LP
- Xwhere
- X.I #
- Xis the logical number of the screen and
- X.I Identifiers
- Xis a list of comma-separated window identifiers for windows which should
- Xalways start on that screen. Note that it is always possible to move
- Xthe window to another screen later.
- X.LP
- XFor example, the following entry will ensure that the windows started
- Xby Sun's AnswerBook (windows with names Navigator and Viewer) will always
- Xstart on screen 6:
- X.br
- X.nf
- X
- XScreen 6 { Navigator, Viewer }
- X
- X.SH WINMENU Actions
- XWhen a window is selected in the WINMENU menu,
- X.I olvwm
- Xwill perform certain actions. The possible actions are the same as those
- Xlisted above for Key Actions, except that the mouse position will not change
- Xon a warp. By default, windows behave as if a warp,
- Xraise, and open were performed on the selected window.
- X.LP
- XTo effect a different action list for a particular window, you can
- Xspecify
- X.IP
- XIdentifier { Actions }
- X.LP
- XEach of these is a MenuGroup; one or more of these can appear
- Xin the following syntax:
- X.IP
- XWINMENU { MenuGroups }
- X.LP
- XFor example, here is a possible entry:
- X.nf
- X
- XWINMENU {
- X "File Manager" {
- X Warp: "Mail Tool"
- X Open: OLVWM_USE_SELECTION
- X }
- X xterm { }
- X "Virtual Desktop" {
- X Open: OLVWM_USE_SELECTION
- X Execute: "$OPENWINHOME/bin/props"
- X }
- X}
- X.SH
- X.LP
- XIf you select the Calendar Manager from your WINMENU, then the view will
- Xwarp to your Mail Tool instead of your file manager, and your file
- Xmanager, if closed, will be opened. [This isn't that contrived an example:
- Xpretend your file manager is sticky and your mail tool isn't, and you
- Xanticipate that you'll need to drag between the two.]
- X.LP
- XIf you select an xterm from your WINMENU, absolutely nothing will happen.
- XThis implements a No-Op for that window.
- X.LP
- XIf you select the VDM from your WINMENU, it will be opened and the properties
- Xapplication will be started.
- X.LP
- XNote that this Identifier list can contain the special entry
- X.I OLVWM_USE_SELECTION
- Xwhich, as you might expect, operates on the single window corresponding to
- Xthe one you selected. A subtle distinction exists here: given the MenuGroup
- X.IP
- Xxterm { Raise: xterm }
- X.LP
- Xthen ALL xterms will be raised when any xterm is selected via the WINMENU.
- XHowever, the entry
- X.IP
- Xxterm { Raise: OLVWM_USE_SELECTION }
- X.LP
- Xwill raise only the xterm corresponding to the one selected via the WINMENU.
- X.SH SEE ALSO
- X.LP
- Xolvwm(1), olwm(1)
- X.SH NOTES
- X.LP
- XPlease see the LEGAL_NOTICES file for full disclosure of copyright
- Xinformation.
- END_OF_FILE
- if test 9546 -ne `wc -c <'olvwmrc.man'`; then
- echo shar: \"'olvwmrc.man'\" unpacked with wrong size!
- fi
- # end of 'olvwmrc.man'
- fi
- if test -f 'olwm.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'olwm.h'\"
- else
- echo shar: Extracting \"'olwm.h'\" \(4886 characters\)
- sed "s/^X//" >'olwm.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents
- X * pending in the U.S. and foreign countries. See LEGAL_NOTICE
- X * file for terms of the license.
- X */
- X
- X#ifndef _OLWM_OLWM_H
- X#define _OLWM_OLWM_H
- X
- X#ident "@(#)olwm.h 26.19 91/09/14 SMI"
- X
- X#ifndef ABS
- X#define ABS(a) (((a) < 0) ? -(a) : (a))
- X#endif
- X
- X#ifndef MAX
- X#define MAX(a,b) (((a) > (b)) ? (a) : (b))
- X#endif
- X
- X#ifndef MIN
- X#define MIN(a,b) ((a) < (b) ? (a) : (b))
- X#endif
- X
- X/* Determine the size of an object type in 32bit multiples.
- X * Rounds up to make sure the result is large enough to hold the object. */
- X#define LONG_LENGTH(a) ((long)(( sizeof(a) + 3 ) / 4))
- X
- X#define FOOTLEN 50L
- X
- X/* protocols bits */
- X#define TAKE_FOCUS (1<<0)
- X#define SAVE_YOURSELF (1<<1)
- X#define DELETE_WINDOW (1<<2)
- X
- X/* Icon positioning modes */
- Xtypedef enum { AlongTop, AlongBottom, AlongRight, AlongLeft,
- X AlongTopRL, AlongBottomRL, AlongRightBT, AlongLeftBT
- X } IconPreference;
- X
- X/* size of icon window */
- X#define ICON_WIN_WIDTH 60
- X#define ICON_WIN_HEIGHT 60
- X#define ICON_GRID_WIDTH 13
- X#define ICON_GRID_HEIGHT 13
- X
- X/* min/max/inc icon sizes */
- X#define ICON_MIN_WIDTH 1
- X#define ICON_MIN_HEIGHT 1
- X#define ICON_MAX_WIDTH 128
- X#define ICON_MAX_HEIGHT 128
- X#define ICON_WIDTH_INC 1
- X#define ICON_HEIGHT_INC 1
- X
- X/* minimum window size */
- X#define MINSIZE 5
- X
- X/* adornment pixmaps */
- Xextern Pixmap pixIcon;
- Xextern Pixmap pixmapGray;
- Xextern Pixmap pixGray;
- X
- X/* miscellaneous functions */
- Xextern int ExitOLWM();
- Xextern void *GetWindowProperty();
- X
- X/* state functions */
- Xextern struct _client *StateNew();
- Xextern void ReparentTree();
- Xextern void StateNormIcon();
- Xextern void StateIconNorm();
- Xextern void StateWithdrawn();
- X
- X/* root window functions */
- Xextern struct _winroot *MakeRoot();
- X
- X/* no-focus window information and functions */
- Xextern Window NoFocusWin;
- Xextern struct _wingeneric *NoFocusWinInfo;
- X
- Xextern struct _wingeneric *MakeNoFocus();
- Xextern void NoFocusTakeFocus();
- Xextern void NoFocusInit();
- Xextern int NoFocusEventBeep();
- X
- X/* client information and functions */
- Xextern struct _List *ActiveClientList;
- X
- Xextern struct _client *ClientCreate();
- Xextern Window ClientPane();
- Xtypedef struct _clientinboxclose {
- X Display *dpy;
- X int screen;
- X int (*func)();
- X short bx, by, bw, bh;
- X Time timestamp;
- X} ClientInBoxClosure;
- Xextern void *ClientInBox();
- Xextern void ClientInhibitFocus();
- Xextern void ClientSetFocus();
- Xextern void ClientSetCurrent();
- Xextern struct _client *ClientGetLastCurrent();
- Xextern void ClientActivate();
- Xextern void ClientFocusTopmost();
- X
- X/* frame functions */
- Xextern struct _winpaneframe *MakeFrame();
- Xextern void FrameSetPosFromPane();
- Xextern void FrameFullSize();
- Xextern void FrameNormSize();
- Xextern void FrameNewFooter();
- Xextern void FrameNewHeader();
- Xextern void FrameSetBusy();
- Xextern void FrameWarpPointer();
- Xextern void FrameUnwarpPointer();
- X
- X/* generic frame functions */
- Xextern int GFrameFocus();
- Xextern int GFrameSelect();
- Xextern int GFrameSetConfigFunc();
- Xextern void GFrameSetStack();
- Xextern void GFrameSetConfig();
- Xextern int GFrameEventButtonPress();
- Xextern int GFrameEventMotionNotify();
- Xextern int GFrameEventButtonRelease();
- Xextern int GFrameEventFocus();
- Xextern int GFrameEventEnterNotify();
- X
- X/* icon functions */
- Xextern void IconInit();
- Xextern struct _winiconframe *MakeIcon();
- Xextern void IconChangeName();
- Xextern void DrawIconToWindowLines();
- Xextern void IconShow();
- Xextern void IconHide();
- Xextern void IconSetPos();
- X
- X/* icon pane functions */
- Xextern struct _winiconpane *MakeIconPane();
- X
- X/* pane functions */
- Xextern struct _winpane *MakePane();
- X
- X/* pinned menu functions */
- Xextern struct _winmenu *MakeMenu();
- X
- X/* colormap functions */
- Xextern struct _wingeneric *MakeColormap();
- Xextern void TrackSubwindows();
- Xextern void UnTrackSubwindows();
- Xextern void ColormapInhibit();
- Xextern void InstallColormap();
- Xextern void InstallPointerColormap();
- Xextern void UnlockColormap();
- Xextern void ColorWindowCrossing();
- Xextern struct _wingeneric *ColormapUnhook();
- Xextern void ColormapTransmogrify();
- X
- X/* selection functions */
- Xextern Bool IsSelected();
- Xextern struct _client *EnumSelections();
- Xextern Time TimeFresh();
- Xextern int AddSelection();
- Xextern Bool RemoveSelection();
- Xextern Bool ToggleSelection();
- Xextern void ClearSelections();
- Xextern void SelectionResponse();
- X
- X/* decoration window functions */
- Xextern struct _winpushpin *MakePushPin();
- Xextern struct _winbutton *MakeButton();
- X
- X/* general window functions */
- Xextern void WinCallFocus();
- Xextern void WinRedrawAllWindows();
- Xextern Bool WinShowHelp();
- X
- X/* general window event functions */
- Xextern int WinEventExpose();
- Xextern int WinNewPosFunc();
- Xextern int WinNewConfigFunc();
- Xextern int WinSetConfigFunc();
- X
- X/* rubber-banding functions */
- Xextern void UserMoveWindows();
- Xextern void UserResizeWin();
- Xextern void TraceRootBox();
- X
- X/* busy windows */
- Xextern struct _winbusy *MakeBusy();
- X
- X#endif /* _OLWM_OLWM_H */
- END_OF_FILE
- if test 4886 -ne `wc -c <'olwm.h'`; then
- echo shar: \"'olwm.h'\" unpacked with wrong size!
- fi
- # end of 'olwm.h'
- fi
- echo shar: End of archive 18 \(of 21\).
- cp /dev/null ark18isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 21 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Molecular Simulations, Inc. mail: dcmartin@postgres.berkeley.edu
- 796 N. Pastoria Avenue uucp: uwvax!ucbvax!dcmartin
- Sunnyvale, California 94086 at&t: 408/522-9236
-